#!/bin/sh
## ---------------------------------------------------------------------
##
## Copyright (C) 2020 by the hyper.deal authors
##
## This file is part of the hyper.deal library.
##
## The hyper.deal library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 3.0 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE.MD at
## the top level directory of hyper.deal.
##
## ---------------------------------------------------------------------

# determine if there is a downloaded version clang-format
if test -f "contrib/utilities/programs/clang-6/bin/clang-format"; then
  cf=$(pwd)'/contrib/utilities/programs/clang-6/bin/clang-format'
else
  cf=$(which clang-format)
fi

# print which clang-forma is used
echo $cf

# format header files
for i in $(find . -type f -name "*.h"); do 
  $cf -i $i
done
# format source files
for i in $(find . -type f -name "*.cc"); do
  $cf -i $i
done
